package com.hydra.auth.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.hydra.base.comment.Comment;
import com.hydra.base.entity.UserTimeEntity;
import com.hydra.base.operate.log.annotation.OperateLogProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.security.core.GrantedAuthority;

/**
 * 系统用户角色
 * @Author Hydra
 * @Date 2022/3/11 17:09
 */
@ToString(callSuper = true)
@TableName(value = "tb_sys_role")
@Comment("系统角色表")
@Accessors(chain = true)
public class SysRole extends UserTimeEntity implements GrantedAuthority {

    /**
     * 角色编码
     */
    @Getter @Setter
    @OperateLogProperty("角色编码")
    String roleCode;

    /**
     * 角色名称
     */
    @Getter @Setter
    @OperateLogProperty("角色名称")
    String roleName;

    /**
     * 状态
     * 1：启用，0：禁用
     */
    @Getter @Setter
    @OperateLogProperty("状态")
    String status;

    @Override
    public String getAuthority() {
        return this.roleCode;
    }

}
